from mysqldb.header import *
from .serializers import *

# Create your views here.


class WePayJsReqsnPayViewSet(viewsets.ModelViewSet):
    __title__ = "JSAPI支付"
    __group__ = "微信支付"
    __info__ = {"post": "JSAPI支付"}
    __doc__ = """
    create:\n
    <h4>JSAPI支付</h4>
    """
    http_method_names = ["post"]
    authentication_classes = []
    permission_classes = [AllPermissions]
    serializer_class = NoneSerializer
    queryset = None

    def create(self, request, *args, **kwargs):
        serializer = self.serializer_class(data=request.data)
        serializer.is_valid(raise_exception=True)
        # serializer.save()
        return Response({"rescode": 200, "resmsg": ""})


class WePayH5ReqsnPayViewSet(viewsets.ModelViewSet):
    __title__ = "H5API支付"
    __group__ = "微信支付"
    __info__ = {"post": "H5API支付"}
    __doc__ = """
    create:\n
    <h4>H5API支付</h4>
    """
    http_method_names = ["post"]
    authentication_classes = []
    permission_classes = [AllPermissions]
    serializer_class = NoneSerializer
    queryset = None

    def create(self, request, *args, **kwargs):
        serializer = self.serializer_class(data=request.data)
        serializer.is_valid(raise_exception=True)
        # serializer.save()
        return Response({"rescode": 200, "resmsg": ""})
